/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#include "GlobalVariables.h"

#include "GameSceneManager.h"

namespace PQClient
{
	GlobalVariables::GlobalVariables()
	{
	}

	void GlobalVariables::setInt32(Int32VarId id,int32 value)
	{
		if(id>=0&&id<Int32_Var_Count){
			_int32Vars[id]=value;
		}else{
			assert(!"GlobalVarTable::setInt32");
		}

	}

	int32 GlobalVariables::getInt32(Int32VarId id)
	{
		if(id>=0&&id<Int32_Var_Count){
			return _int32Vars[id];
		}else{
			assert(!"GlobalVarTable::getInt32");
		}

		return 0;

	}

	void GlobalVariables::setString(StringVarId id,std::string value)
	{
		if(id>=0&&id<String_Var_Count){
			_strVars[id]=value;
		}else{
			assert(!"GlobalVarTable::setString");
		}
	}


	std::string GlobalVariables::getString(StringVarId id)
	{
		if(id>=0&&id<String_Var_Count){
			return _strVars[id];
		}else{
			assert(!"GlobalVarTable::getString");
		}

		return 0;
	}


	void GlobalVariables::setRunningState(SceneId id,RunningState value)
	{
		if(id>=0&&id<Scene_Count){
			_states[id]=value;
		}else{
			assert(!"GlobalVarTable::setRunningState");
		}

	}

	RunningState GlobalVariables::getRunningState(SceneId id)
	{
		if(id>=0&&id<Scene_Count){
			return _states[id];
		}else{
			assert(!"GlobalVarTable::getRunningState");
		}

		return Running_State_Unkow;
		
	}

	RunningState GlobalVariables::getRunningState()
	{
		SceneId id=GameSceneManager::getSingleton().getActiveSceneId();
		return getRunningState(id);
	}


	SceneId GlobalVariables::getActiveSceneId()
	{
		return GameSceneManager::getSingleton().getActiveSceneId();
	}

	void GlobalVariables::setActiveSceneId(SceneId id)
	{
		GameSceneManager::getSingleton().setActiveSceneId(id);
	}


}

